package org.swimv2.model;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the richiestaamicizia database table.
 * 
 */
@Entity
@NamedQueries({
@NamedQuery(name="Richiestaamicizia.findByRicevente", query="SELECT r FROM Richiestaamicizia r WHERE r.id.userIDricevente=:userId AND r.stato=:stato"),
@NamedQuery(name="Richiestaamicizia.findByRichiedente", query="SELECT r FROM Richiestaamicizia r WHERE r.id.userIDrichiedente=:userId AND r.stato=:stato"),
@NamedQuery(name="Richiestaamicizia.findById",query="SELECT r FROM Richiestaamicizia r WHERE r.persona2.userID=:idRichiedente AND r.persona1.userID=:idRicevente"),
@NamedQuery(name="Richiestaamicizia.findByIdIndiretto",query="SELECT r FROM Richiestaamicizia r WHERE r.stato=:stato AND r.tipo=:tipo AND ((r.persona2.userID=:idRichiedente AND r.persona1.userID=:idRicevente)OR( r.persona2.userID=:idRicevente AND r.persona1.userID=:idRichiedente))")
})
public class Richiestaamicizia implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private RichiestaamiciziaPK id;

	private String stato;

	private String tipo;

	//bi-directional many-to-one association to Persona
	@ManyToOne
	@JoinColumn(name="userIDricevente", insertable=false, updatable=false)
	private Persona persona1;

	//bi-directional many-to-one association to Persona
	@ManyToOne
	@JoinColumn(name="userIDrichiedente", insertable=false, updatable=false)
	private Persona persona2;

	public Richiestaamicizia() {
	}

	public RichiestaamiciziaPK getId() {
		return this.id;
	}

	public void setId(RichiestaamiciziaPK id) {
		this.id = id;
	}

	public String getStato() {
		return this.stato;
	}

	public void setStato(String stato) {
		this.stato = stato;
	}

	public String getTipo() {
		return this.tipo;
	}

	public void setTipo(String tipo) {
		this.tipo = tipo;
	}

	public Persona getPersona1() {
		return this.persona1;
	}

	public void setPersona1(Persona persona1) {
		this.persona1 = persona1;
	}

	public Persona getPersona2() {
		return this.persona2;
	}

	public void setPersona2(Persona persona2) {
		this.persona2 = persona2;
	}

}